#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
struct ssbb
{
	int l,k,all;
}a[200005];
int n=1,m,s[200005]={0};
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>m;
	int ggg;
	cin>>ggg;
	a[1].all++;
	a[1].l++;
	a[1].k=ggg;
	for(int i=2;i<=m;i++)
	{
		int gg;
		scanf("%d",&gg);
		if(gg==a[n].k)
		{
			a[n].l++;
			a[n].all++;
		}
		else 
		{
			n++;
			a[n].k=gg;
			a[n].l++;
			a[n].all++;
		}
	}
	for(int i=1;i<=n;i++)s[i]=s[i-1]+a[i].all;
	while(m>0)
	{
		int now=-1;
		for(int i=1;i<=n;i++)
		{
			if(now!=a[i].k&&a[i].l!=0)
			{
				printf("%d ",s[i]-a[i].l+1);
				a[i].l--;
				m--;
				now=a[i].k;
			}
		}
		printf("\n");
	}
	
	return 0;
}
